Menu / Sub Menu / Autonav fun
PermalinkHappy New Year. Started with Concrete yesterday and almost managed to port a site into it in a day - terrific product. I have run into a problem with the autonav though and hoping someone might be able to help.
The site I am porting ishttp://www.discovery.net.au/
The C5 dev environment can be seen here:
http://discovery.net.au/dev/
This post pertains the the nav menu's at the top (Products / Communications / Consultancy Services / Solution) As you will see on the live site, each of these are parents to a drop down nested list menu.
The problem I seem to be having is that the autonav doesn't appear to be nesting the child menus in the parents correctly. On this pagehttp://discovery.net.au/dev/index.php/products/... I have edited the nav settings to be:
Pages Should appear = in their site map order
Display Pages = at the top level
Sub pages to Display = relevant sub pages
Sub- page level = Display all
With these, you'll see that the menu is happening, but Communications / Consultancy Services / Solution are appearing as children of "Products"
I know it can be done because these guys are doing it!
http://www.circlekwest.com/
I've tried to write my own version of header_menu.php but didn't get very far. Anyone got some ideas of what i am doing wrong?
Cheers
<ul>
<li>Products
<ul>
<li>Product 1</li>
<li>Product 2</li>
<li>Product 3</li>
<li>Communications</li>
<li>Consultancy Services</li>
<li>Solutions</li>
</ul>
whereas it should be
<ul>
<li>Products
<ul>
<li>Product 1</li>
<li>Product 2</li>
<li>Product 3</li>
</ul>
<li>Communications</li>
<li>Consultancy Services</li>
<li>Solutions</li>
</ul>
I guess it's cause if i look at header_menu.php, there doesn't seem to be (from my limited php knowledge) any hints of nested lists.
Anyone that can give a non-programmer any clues as to how to fix this?
:D
hopefully my ramblings will be of use to someone else
glad you helped yourself in public. ;)
the php template used for header_nav actually does not produce nested <li>s, even though the one for a regular autonav does.
i had to change the php in that file to get it to work.
I am enclosing the fixed header_menu.php in case it helps someone else.
The sub menu items are not showing up at all. Its not a css issue, I'm purely talking about getting the structure right in the html for a 2-level dropdown menu (the same as Ben describes above).
I am complete newbie to C5, and the site I am building wasnt built by me (I am finishing off someone elses unfinished project). When I check the sitemap in the admin area though, there are about 5 main menu items, each with sub menu items. Their properties show that they havent been excluded from the nav.
In the template file, I am using this code:
<div id="mainmenu"> <?php $a = new Area('Header Nav'); $a->setBlockLimit(1); $a->display($c); ?> </div>
Any ideas why its not working?
The html that is displaying looks like this:
<div id="mainmenu"> <ul class="nav-header"> <li><a href="link1/">Link 1</a></li> <li><a href="link2/">Link 2</a></li> </ul> </div>
Is there a 'site-wide' option to be able to do this?
Perhaps I need to create a custom page attribute, that specifies that the page needs to display all sub pages, display a custom amount of sub pages, and then set this to 1.
But I have no idea of how to go about that!
Paul.
http://www.Antropy.co.uk
Just started yesterday with C5 and need some help. Thanks in advance.
Need to have rollover sub menu to show up in header menu
For the others who are banging on about it being a CSS/other issue.
The cause of this problem is the templates (header_menu.php etc) do not include the required php calls to produce nested lists.
A lot of people (myself included) were modifying header_menu.php and was left wondering why nested lists were not being produced.
Copying the code from /blocks/autonav/view.php into a custom template works wonders. Its well commented and very useful.
Here is the clean answer:
header_menu.php
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); $aBlocks = $controller->generateNav(); global $c; echo("<ul class=\"nav-header\">"); $nh = Loader::helper('navigation'); foreach($aBlocks as $ni) { $_c = $ni->getCollectionObject(); if (!$_c->getCollectionAttributeValue('exclude_nav')) { $thisLevel = $ni->getLevel(); if ($thisLevel > $lastLevel) { echo("<ul class='sub_navi'>"); } else if ($thisLevel < $lastLevel)
Like many people here, I was getting a list of 'li's with no 'ul's.
http://de.selfhtml.org/css/layouts/navigationsleisten.htm...
You'll only need the two examples from the bottom.